//
//  UILabel+extension.m
//  BASE_LIB
//
//  Created by shiji on 2018/11/7.
//  Copyright © 2018 shiji. All rights reserved.
//

#import "UILabel+extension.h"

@implementation UILabel (extension)
- (CGSize)size {
    return [self size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1000)];
}

- (CGSize)size:(CGSize)size {
    NSDictionary *attribute = @{NSFontAttributeName: self.font};
    CGSize retSize = [self.text boundingRectWithSize:size
                                             options:
                      NSStringDrawingTruncatesLastVisibleLine |
                      NSStringDrawingUsesLineFragmentOrigin |
                      NSStringDrawingUsesFontLeading
                                          attributes:attribute
                                             context:nil].size;
    
    return retSize;
    
}

- (CGSize)fitSize {
    return [self sizeThatFits:self.frame.size];
}

@end
